//echart options 模板
import * as echarts from "echarts";

export const ECOpts = {
	title: {
		show: false,
		text: "img-" + Date.now(),
		subtext: "", //`水位趋势（${queryFrom.timeRange[0]} ~ ${queryFrom.timeRange[1]}）`,
		top: "20",
		left: "50%",
		textAlign: "center"
	},
	color: ["#4a9fea", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#1D7BCE", "#9a60b4", "#ea7ccc"],
	tooltip: {
		trigger: "axis",
		// formatter: "{b} <br/> {a}: {c} 条",
		axisPointer: {
			type: "shadow"
		}
	},
	toolbox: {
		show: true,
		right: "30",
		top: "15",
		feature: {
			dataZoom: {
				yAxisIndex: "none",
				title: { zoom: "区域缩放", back: "区域缩放还原" }
			},
			magicType: {
				type: ["line", "bar"],
				title: { line: "折线图", bar: "柱状图" },
				restore: {}
			},
			saveAsImage: {
				show: true,
				title: "保存为图片"
			}
		}
	},
	dataZoom: [
		{
			show: false,
			start: 0,
			end: 100
		},
		{
			type: "inside",
			start: 0,
			end: 100
		}
	],
	legend: {
		show: true,
		type: "scroll",
		orient: "horizontal", //horizontal|vertical
		top: "20px",
		align: "left",
		textStyle: {
			fontSize: 14
		}
	},
	xAxis: [
		{
			// splitLine: {show: true, lineStyle: {color: '#ccc'}},
			axisLine: { show: true, lineStyle: { color: "#333" } },
			axisLabel: { rotate: 0, textStyle: { color: "#333" } },
			data: [],
			type: "category",
			boundaryGap: false
			// textStyle: {
			//   color: '#fff'
			// }
		}
	],
	yAxis: [
		{
			type: "value",
			splitLine: { show: true, lineStyle: { color: "#ccc" } },
			axisLine: {
				show: true,
				lineStyle: { color: "#333" }
			},
			axisLabel: { color: "#333", formatter: `{value}` }
		}
	],
	grid: {
		left: "5%",
		right: "5%",
		bottom: "5%",
		top: "15%",
		containLabel: true
	},
	series: []
};
export const ECSeries = [
	{
		type: "line",
		smooth: true,
		name: "数量",
		radius: "50%",
		barMaxWidth: "50",

		// 折线图线条颜色
		lineStyle: {
			color: "#589bc570",
			width: 4
		},
		// showSymbol: false,//曲线上的数据点
		//区域图-背景
		areaStyle: {
			opacity: 1,
			color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
				{
					offset: 0, //底部
					color: "#1D7BCE"
				},
				{
					offset: 0.5, //50%位置
					color: "#1D7BCE80"
				},
				{
					offset: 1, //顶部
					color: "#1D7BCE50"
				}
			])
		},
		//柱状图-柱子背景(饼图需要置空，否则无法区分)
		itemStyle: {
			normal: {
				color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
					{ offset: 0, color: "#1D7BCE" },
					{ offset: 0.7, color: "#1D7BCE50" },
					{ offset: 1, color: "#1D7BCE20" }
				])
			},
			emphasis: {
				//鼠标移动上去高亮
				focus: "series",
				blurScope: "coordinateSystem",
				// color:'#1D7BCE'
				color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
					{ offset: 0, color: "#4a9fea00" },
					{ offset: 0.4, color: "#4a9fea70" },
					{ offset: 1, color: "#4a9fea" }
				])
			}
		},
		// markLine: {
		//   data: [
		//     { type: 'average', name: '平均值' }
		//   ]
		// },
		markPoint: {
			data: [
				{ type: "max", name: "最大值", label: { color: "#fff" } },
				{ type: "min", name: "最小值", label: { color: "#fff" } }
			]
		},
		emphasis: {
			focus: "series",
			itemStyle: {
				shadowBlur: 10,
				shadowOffsetX: 0,
				shadowColor: "rgba(0, 0, 0, 0.5)"
			}
		},
		data: []
	}
];
